﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

namespace mpsalary
{
    public partial class forgetPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PanelSignup.Visible = false;
            
        }

        protected void btnforgetPassword_Click(object sender, EventArgs e)
        {
            try
            {

                MailMessage email = new MailMessage();
                email.From = new MailAddress("Fromthepgsteam@gmail.com", "PGS Portal");
                email.To.Add(new MailAddress(tbxemail.Text));
                email.Subject = "Forget your password?";
                email.Body = "<html><body>Hello again,<br><br><br>Here's the PGS Portal information you have requested - be sure to keep it in a safe place.</body></html>";
                email.IsBodyHtml = true;
                email.Priority = MailPriority.Normal;

                SmtpClient mailclient = new SmtpClient("smtp.gmail.com");
                mailclient.Credentials = new System.Net.NetworkCredential("thepgsteam@gmail.com", "thepgsteam");
                mailclient.Port = 587;
                mailclient.EnableSsl = true;
                mailclient.Send(email);

                lblemail.Text = "email sent";
            }
            catch
            {
                lblemail.Text = "Sending of mail failed";
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
            Panelforgetpassword.Visible = true;
            PanelSignup.Visible = false;
            tbxemail.Text = "";
            lblemail.Text = "";
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Panelforgetpassword.Visible = false;
            PanelSignup.Visible = true;

            

        }



    }
}